package demo4;

import java.util.Objects;

class Person {
    public String name;

    public int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {
     Person person=(Person) obj;
      if (this.name.equals(person.name)){
             return true;
      }
      return false;
    }
}
public class Test {
//    public static void main(String[] args) {
//    Person person1 =new Person("lisi",13);
//    Person person2 =new Person("lisi",13);
//        System.out.println(person1.equals(person2));
//        System.out.println(person1==person2);
//        System.out.println(person1.hashCode());
//        String str="afggggg";
////        System.out.println(str.length());
////        String str2=null;
////        System.out.println(str2);
////        System.out.println(str2.length());
//        String str3="";
//        System.out.println(str3.length());
////        System.out.println(str3.isEmpty());
//    }

    public static void main(String[] args) {
        String str1="asdfghj";
        String str2="asdfghj";
        String str3=new String("hello");
        String str4=new String("hello");
        System.out.println(str1==str2);
        System.out.println(str3==str4);
    }
}
